<?php
Zend::loadClass('Lead_EDO_Datatype_Field');

/**
 * Datatype for string
 * 
 * @package EDO
 * @subpackage Datatypes
 *
 */
class Lead_EDO_Datatype_String extends Lead_EDO_Datatype_Field 
{
	protected $_SQLValueIsQuoted = true;	
		
	
	public function __toString()
	{
	    return $this->getValue();
	}
	
	
	
	public function validate($validate)
	{
	    if(!$this->notNull() AND (empty($validate) AND $validate != '0'))
			return null;
		
		if(strlen($validate) == 0)
			return false;
				
			
		if(!isset($this->config['size']))
			$this->config['size'] = 255;
		
			
		
		if(is_string($validate))
		{
			
			
			if(strlen($validate) <= $this->config['size'])
			{
			
				
				return $validate;
			}
			
			
			
		}
		
		
		
		return false;
		
	}
	
	
	
}
?>